class Solution {
public:
    ListNode* FindFirstCommonNode(ListNode* pHead1, ListNode* pHead2)
    {
        ListNode* l1 = pHead1, * l2 = pHead2;
        while (l1 != l2) {
            l1 = l1 ? l1->next : pHead2;
            l2 = l2 ? l2->next : pHead1;
        }
        return l2;
    }
};